package com.etc.zmall.service.impl;

import java.util.List;

import com.etc.util.MD5Util;
import com.etc.zmall.dao.ShopDao;
import com.etc.zmall.dao.impl.ShopDaoImpl;
import com.etc.zmall.entity.Shop;
import com.etc.zmall.service.ShopService;

/**

* <p>Title: ShopServiceImpl</p>

* <p>Description: </p>

* @author knowno

* @date 2021年1月11日

*/
public class ShopServiceImpl implements ShopService {
	ShopDao sd = new ShopDaoImpl();
	
	@Override
	public boolean SLogin(String shopname, String shoppwd) {
		// 将密码转换为密文
		String pwd = MD5Util.getEncodeByMd5(shoppwd);
		boolean flag = sd.shopLogin(shopname, pwd);
		if (flag)
			return true;
		return false;
	}
	
	@Override
	public List<Shop> QueryAllShop() {
		List<Shop> list=sd.queryAllShop();
		return list;
	}

	@Override
	public boolean setShopState(String shopname, int state) {
		boolean f=sd.upDateShop(shopname, state);
		if(f) {
			return true;
		}
		return false;
	}
	@Override
	public List<Shop> selShopname(String shopname) {
		List<Shop> list=sd.selShopname(shopname);
		if(list.size()>0)
			return list;
		return null;
	}

	@Override
	public Shop queryOneShop(int shopid) {
		// TODO Auto-generated method stub
		return sd.queryOneShop(shopid);
	}

	@Override
	public Shop queryOneShop(String shopuser) {
		// TODO Auto-generated method stub
		return sd.queryOneShop(shopuser);
	}

	@Override
	public boolean upDateShop(int shopid, String shopname, String shopphone) {
		// TODO Auto-generated method stub
		return sd.upDateShop(shopid, shopname, shopphone);
	}
}
